package cn.hinglo.gameclaw.data.timer;

import cn.hinglo.gameclaw.user.service.PopularityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @createTime: 2018/1/9
 * @author: HingLo
 * @description: 人气榜排行的定时任务处理
 */
@Component
@Slf4j
public class PopularityTimer {


    private final PopularityService popularityService;

    @Autowired
    public PopularityTimer(PopularityService popularityService) {
        this.popularityService = popularityService;
    }

    /**
     * 用于生成人气榜数据，每天12.00更新
     */
    @Scheduled(cron = "0 0 12 * * ?")
    public void popularityTimer() {

        boolean bool = popularityService.updatePopularService();
        if (bool) {
            log.info("人气榜更新数据成功");
        }

        log.info("人气榜更新数据失败");


    }
}
